package ar.edu.utn.frsf.tpae.a2012.g03.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author fededalla
 */
@Entity
@Table(name = "cta_cte")
@NamedQueries({
    @NamedQuery(name = "CuentaCorriente.findAll", query = "SELECT c FROM CuentaCorriente c"),
    @NamedQuery(name = "CuentaCorriente.findByCtaId", query = "SELECT c FROM CuentaCorriente c WHERE c.ctaId = :ctaId"),
    @NamedQuery(name = "CuentaCorriente.findByCtaCteMaxOpMens", query = "SELECT c FROM CuentaCorriente c WHERE c.ctaCteMaxOpMens = :ctaCteMaxOpMens"),
    @NamedQuery(name = "CuentaCorriente.findByCtaCteCostMant", query = "SELECT c FROM CuentaCorriente c WHERE c.ctaCteCostMant = :ctaCteCostMant"),
    @NamedQuery(name = "CuentaCorriente.findByCtaCteLimSdoNeg", query = "SELECT c FROM CuentaCorriente c WHERE c.ctaCteLimSdoNeg = :ctaCteLimSdoNeg"),
    @NamedQuery(name = "CuentaCorriente.findByCtaCteIntSdoNeg", query = "SELECT c FROM CuentaCorriente c WHERE c.ctaCteIntSdoNeg = :ctaCteIntSdoNeg")})
public class CuentaCorriente extends Cuenta {
    @Basic(optional = false)
    @Column(name = "cta_cte_max_op_mens", nullable = false)
    private int ctaCteMaxOpMens;
    @Basic(optional = false)
    @Column(name = "cta_cte_cost_mant", nullable = false)
    private double ctaCteCostMant;
    @Basic(optional = false)
    @Column(name = "cta_cte_lim_sdo_neg", nullable = false)
    private double ctaCteLimSdoNeg;
    @Basic(optional = false)
    @Column(name = "cta_cte_int_sdo_neg", nullable = false)
    private double ctaCteIntSdoNeg;
    /*@JoinColumn(name = "cta_id", referencedColumnName = "cta_id", nullable = false, insertable = false, updatable = false)
    @OneToOne(optional = false)
    private Cuenta cta;*/

    public CuentaCorriente() {
    }

    public CuentaCorriente(Integer ctaId) {
        this.ctaId = ctaId;
    }

    public CuentaCorriente(Integer ctaId, long ctaNro, Date ctaFechApe, double ctaSdoAct, int ctaCteMaxOpMens, double ctaCteCostMant, double ctaCteLimSdoNeg, double ctaCteIntSdoNeg, Cliente ctaCliId) {
        super(ctaId, ctaNro, ctaFechApe, ctaSdoAct, ctaCliId);
        this.ctaCteMaxOpMens = ctaCteMaxOpMens;
        this.ctaCteCostMant = ctaCteCostMant;
        this.ctaCteLimSdoNeg = ctaCteLimSdoNeg;
        this.ctaCteIntSdoNeg = ctaCteIntSdoNeg;
    }

    public Integer getCtaId() {
        return ctaId;
    }

    public void setCtaId(Integer ctaId) {
        this.ctaId = ctaId;
    }

    public int getCtaCteMaxOpMens() {
        return ctaCteMaxOpMens;
    }

    public void setCtaCteMaxOpMens(int ctaCteMaxOpMens) {
        this.ctaCteMaxOpMens = ctaCteMaxOpMens;
    }

    public double getCtaCteCostMant() {
        return ctaCteCostMant;
    }

    public void setCtaCteCostMant(double ctaCteCostMant) {
        this.ctaCteCostMant = ctaCteCostMant;
    }

    public double getCtaCteLimSdoNeg() {
        return ctaCteLimSdoNeg;
    }

    public void setCtaCteLimSdoNeg(double ctaCteLimSdoNeg) {
        this.ctaCteLimSdoNeg = ctaCteLimSdoNeg;
    }

    public double getCtaCteIntSdoNeg() {
        return ctaCteIntSdoNeg;
    }

    public void setCtaCteIntSdoNeg(double ctaCteIntSdoNeg) {
        this.ctaCteIntSdoNeg = ctaCteIntSdoNeg;
    }

   /* public Cuenta getCuenta() {
        return cta;
    }

    public void setCuenta(Cuenta cta) {
        this.cta = cta;
    }*/

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (ctaId != null ? ctaId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CuentaCorriente)) {
            return false;
        }
        CuentaCorriente other = (CuentaCorriente) object;
        if ((this.ctaId == null && other.ctaId != null) || (this.ctaId != null && !this.ctaId.equals(other.ctaId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.CuentaCorriente[ ctaId=" + ctaId + " ]";
    }
    
}
